<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新品有戏后台管理</title>
    <link href="__CSS__/boot.css" rel="stylesheet">
    <link href="__STATIC__/layui/css/layui.css" rel="stylesheet">
    <script src="__JS__/jquery.js"></script>
    <script src="__JS__/layer/layer.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <style>
        th{
            text-align: center;
            vertical-align: middle!important;
        }
    </style>
</head>
<body>
{include file="base/header" /}
<label style="color:#000;font-size: 15px;">销售额为：{$count}元</label>
<div style="float: right; margin-top: 5px;margin-bottom: 5px" class="box-title ">
    <form class="form-inline" action="{:url('index/onlineorder/onlinepurchase')}" method="get">
        <div class="layui-inline"> <!-- 注意：这一层元素并不是必须的 -->
            <input type="text" style="text-align: center" class="layui-input" id="start" name="start"
                   value="<?php if(isset($date)){ echo $date;}else{ echo $start;}?>"/>
        </div>
        -
        <div class="layui-inline"> <!-- 注意：这一层元素并不是必须的 -->
            <input type="text" style="text-align: center"  class="layui-input" id="end" name="end" value="<?php if(isset($date)){ echo $date;}else{echo $end;}?>"/>

        </div>
        <input type="hidden" name="sid" value="{$sid}"/>
        <input type="text" name="ordernumber" value="<?php if(isset($ordernumber)) echo $ordernumber ?>" class="form-control" id="exampleInputEmail3" >
        <input type="submit" class="btn btn-default" value="搜索"/>
        <input type="button" onclick="res({$sid})" value="全部显示" class="btn btn-default"/>
    </form>
</div>
<table class="layui-table">
    <colgroup>
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th>订单号</th>
        <th>下单时间</th>
        <th style="width: 100px">操作</th>
    </tr>
    </thead>
    <tbody>
    {foreach $result as $val}
    <tr>
        <td>{$val.ordernumber}</td>
        <td>{$val.date}</td>
        <td>
            <button type="button" onclick="detail({$val.ordernumber},{$sid})" class="btn btn-primary btn-xs">详情</button>
        </td>
    </tr>
    {/foreach}
    </tbody>
</table>
{$result->render()}
</body>
<script>
    //订单详情
    function detail(ordernumber,sid) {
        window.location.href = "{:url('index/onlineorder/detail')}?ordernumber="+ordernumber+"&sid="+sid;
    }
    //显示全部
    function res(sid) {
        window.location.href = "{:url('index/onlineorder/onlinepurchase')}?sid="+sid;
    }


    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });
        laydate.render({
            elem: '#end' //指定元素
        });
    });
</script>
</html>